package com.ludomancy.spaceopera.entities;

import java.awt.Graphics;
import java.awt.Point;

import com.ludomancy.gamelib.ImageStrip;
import com.ludomancy.gamelib.ResourceManager;
import com.ludomancy.spaceopera.BasicEntity;
import com.ludomancy.spaceopera.Game;
import com.ludomancy.spaceopera.InventoryItem;
import com.ludomancy.spaceopera.Player;

public class CollectableItem extends BasicEntity
{
	private int type;
	private ImageStrip sprites;
	
	public CollectableItem(int type)
	{
		super(new Point());
		this.type = type;
		sprites = new ImageStrip(ResourceManager.getImage("buttons.png"), 20, 24);
		width = (int) proj.screenToWorldX(sprites.frameWidth);
		height = (int) proj.screenToWorldY(sprites.frameHeight);
	}
	
	public int[] getBitmask(int x, int y, int w, int h)
	{
		return sprites.getBitmask(type, x, y, w, h);
	}
	
	public void paint(Graphics g, int x, int y)
	{
		sprites.paint(g,type, x, y);
	}
	
	public void onPlayerHit(Player player)
	{
		Game.game.station.addItem(new InventoryItem(type));
		parent.remove(this);
	}	
}
